home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / eulisp / comp0_89.lha / Feel / Boot / Compiler / mod-cache.em < prev    next >
Lisp/Scheme  |  1993-07-12  |  1KB  |  62 lines

  1. ;; Eulisp Module
  2. ;; Author: pete broadbery
  3. ;; File: mod-cache.em
  4. ;; Date: 18/sep/1991
  5. ;;
  6. ;; Project:
  7. ;; Description: 
  8. ;; reads and caches the exports of a module 
  9. ;;
  10.  
  11. (defmodule mod-cache 
  12.   ((except (fold) standard)
  13.    list-fns
  14.    
  15.    comp-utl
  16.    )
  17.   ()
  18.   
  19.   ;; Badly named. Something holding the property list of a module.
  20.  
  21.   (defstruct import-module ()
  22.     ((props initarg props accessor imported-module-props))
  23.     constructor (make-imported-module props))
  24.  
  25.   (export import-module)
  26.  
  27.   (defconstant mod-exports (mk-finder))
  28.  
  29.   (defconstant *default-interface-path*
  30.     ".:/net/brad/denton_export/denton/You/NewYou/Interfaces:/net/brad/denton_export/denton/You/Interfaces")
  31.  
  32.   (defconstant *interface-path* (make-search-path 
  33.                  "FEEL_INTF_PATH" #\:
  34.                  *default-interface-path*))
  35.  
  36.  
  37.   (defun read-names (stream)
  38.     (let* ((raw-names (read stream))
  39.        (mod (make-imported-module raw-names)))
  40.       (mapcar (lambda (info)
  41.         (list (cdr (assq 'name info))
  42.               info mod))
  43.           (cdr (assq 'exported-ids raw-names)))))
  44.  
  45.   ;; Interface function
  46.   (defun read-exportations (modname)
  47.     (format t "Reading: ~a~%" modname)
  48.     (or (mod-exports modname)
  49.     (let ((file (path-open *interface-path*
  50.                    (interface-file-name modname))))
  51.       (unwind-protect
  52.         (let ((exps (read-names file)))
  53.           ((setter mod-exports) modname exps)
  54.           exps)
  55.         (close file)))))
  56.     
  57.   (export read-exportations
  58.       imported-module-props
  59.       get-module-stream)
  60.   ;; end module
  61.   )
  62.